#include "SCI_HAL_GB.h"

void vfnSCI_SetBaudRate (uint16 u16baudrate)
{
    SCI1BD = u16baudrate;
}

void vfnSCI_Init (void)
{
    SCI1C1 = SCI_CONTROL_REG1;
    SCI1C2 = SCI_CONTROL_REG2;
    SCI1C3 = 0x00;  
}

// Frequently called functions for Channel 1

void vfnSCI1_SendByte (uint8 u8data)
{
    SCI1D = u8data;
}

uint8 u8SCI1_TxBufferEmpty (void)
{
    return SCI1S1_TDRE;
}

uint8 u8SCI1_TxComplete (void)
{
    return SCI1S1_TC;
}

uint8 u8SCI1_CheckOverrun (void)
{
    return SCI1S1_OR;
}

uint8 u8SCI1_ReadByte (void)
{
    return SCI1D;
}

uint8 u8SCI1_RxPending (void)
{
    return SCI1S1_RDRF;
}

// Frequently called functions for Channel 2

void vfnSCI2_SendByte (uint8 u8data)
{
    SCI2D = u8data;
}

uint8 u8SCI2_TxBufferEmpty (void)
{
    return SCI2S1_TDRE;
}

uint8 u8SCI2_TxComplete (void)
{
    return SCI2S1_TC;
}

uint8 u8SCI2_CheckOverrun (void)
{
    return SCI2S1_OR;
}

uint8 u8SCI2_ReadByte (void)
{
    return SCI2D;
}

uint8 u8SCI2_RxPending (void)
{
    return SCI2S1_RDRF;
}




